# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=just
pkgver=1.25.2
pkgrel=0
pkgdesc="Just a command runner"
url="https://github.com/casey/just"
# riscv64: rust currently broken on this arch
# s390x: blocked by nix crate
arch="all !riscv64 !s390x"
license="CC0-1.0"
checkdepends="bash fzf"
makedepends="cargo cargo-auditable"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/casey/just/archive/$pkgver/just-$pkgver.tar.gz"

export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	# Skipped tests are somehow broken.
	cargo test --frozen -- \
		--skip choose::default \
		--skip edit::editor_precedence \
		--skip functions::env_var_functions
}

package() {
	install -D -m755 target/release/just -t "$pkgdir"/usr/bin/

	install -D -m644 man/just.1 -t "$pkgdir"/usr/share/man/man1/

	install -D -m644 completions/just.bash \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -D -m644 completions/just.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
	install -D -m644 completions/just.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
651e132d98160ace78f1e6aa55fe7e697709322eac3aad37630d41eda8381652c876a69ec82663f174390c1bc1dfcfd734b052660e625919e6c78922ae74ce4e  just-1.25.2.tar.gz
"
